package com.lagou.sortdata;

import org.apache.hadoop.io.LongWritable;
import org.apache.hadoop.mapreduce.Reducer;

import java.io.IOException;

public class FileDataReducer extends Reducer<LongWritable,LongWritable,LongWritable,LongWritable> {
    LongWritable seqs = new LongWritable(1);
    long seq = 1;
    protected void reduce(LongWritable key, Iterable<LongWritable> values, Context context)
            throws IOException, InterruptedException {
        //遍历values输出key，并且为数据添加行号
        for(LongWritable v:values){
            context.write(seqs,key);
            seqs = new LongWritable(seqs.get() + 1);
        }
    }}
